﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Practices.Unity;

namespace Happy.Bootstrap.Unity.Internal
{
    internal class EventSubscriberRegister : IConventionRegister
    {
        public bool Register(IUnityContainer container, Type serviceType)
        {
            if (serviceType.Name.EndsWith("EventSubscriber"))
            {
                container.RegisterTypeForAllInterface(serviceType.FullName, serviceType, () => new TransientLifetimeManager());

                return true;
            }

            return false;
        }
    }
}
